## Replication File for: Lily Tsai and Yiqng Xu. "Outspoken Insiders:
## Political Connections and Citizen Participation in Authoritarian
## China"

## Mechanisms (Figure 2)

rm(list=ls(all=TRUE))
library(foreign)

(d<-read.csv("mechanisms.csv"))
d$CI_lower <- d$coef - 1.96*d$se
d$CI_upper <- d$coef + 1.96*d$se
d$outcome <- c("Access Gov.\nStatues","Know\nMajor's Name",
               "Use Email\nRegularly","Know Township\nHead's Name",
               "Know\nGovernor's Name","Read\nNewspapers",
               "Use Conn. for\nPub. Sev.","Deal with the\nGoverment",
               "Pull Strings for\nBenefits","Cadres Welcome\nInputs",
               "Towship\nWelcomes Inputs",
               "County Welcomes\nInputs")



## information
par(mar=c(5,5,2,2),mfcol=c(2,1))
plot(1,xlim=c(0.75,6.75),type="n",ylim=c(-0.10,0.30),axes=F,xlab="",ylab="")
abline(v = seq(0,10,0.25), col = "gray80")
abline(h = seq(-0.5, 0.5,0.025), col = "gray80")
abline(h = 0, col = "gray80", lwd = 8)
for (i in 1:3) {lines(c(i,i), c(d$CI_lower[i], d$CI_upper[i]), lwd = 3)}
for (i in 4:6) {lines(c(i,i)+0.5, c(d$CI_lower[i], d$CI_upper[i]), lwd = 3)}
points(1:3, d$coef[1:3], pch = 16, cex =2)
points(c(4:6)+0.5, d$coef[4:6], pch = 17, cex =1.8)
axis(side=2)
mtext("Marginal Effect of Political\nConnections",line=2.5,side=2,cex=1.2)
axis(side=1,tick=F,line=0.5,at=c(1,3,4.5,6.5),labels=d$outcome[c(1,3,4,6)],cex.axis=1.2)
axis(side=1,tick=F,line=2,at=c(2,5.5),labels=d$outcome[c(2,5)],cex.axis=1.2)
title("Political Knowledge", line = 0.5, cex.main = 1.8)
text(2,0.27,"Urban", col = "gray70", cex = 2, font = 2)
text(5.5,0.27,"Rural", col = "gray70", cex = 2, font = 2)
box()
## acess
plot(1,xlim=c(0.75,6.75),type="n",ylim=c(-0.10,0.30),axes=F,xlab="",ylab="")
abline(v = seq(0,10,0.25), col = "gray80")
abline(h = seq(-0.5, 0.5,0.025), col = "gray80")
abline(h = 0, col = "gray80", lwd = 8)
for (i in 1:3) {lines(c(i,i), c(d$CI_lower[i+6], d$CI_upper[i+6]), lwd = 3)}
for (i in 4:6) {lines(c(i,i)+0.5, c(d$CI_lower[i+6], d$CI_upper[i+6]), lwd = 3)}
points(1:3, d$coef[7:9], pch = 16, cex =2)
points(c(4:6)+0.5, d$coef[10:12], pch = 17, cex =1.8)
axis(side=2)
mtext("Marginal Effect of Political\nConnections",line=2.5,side=2,cex=1.2)
axis(side=1,tick=F,line=0.5,at=c(1,3,4.5,6.5),labels=d$outcome[c(7,9,10,12)],cex.axis=1.2)
axis(side=1,tick=F,line=2,at=c(2,5.5),labels=d$outcome[c(8,11)],cex.axis=1.2)
box()
title("Acess to Authorities", line = 0.5, cex.main = 1.8)
text(2,0.27,"Urban", col = "gray70", cex = 2, font = 2)
text(5.5,0.27,"Rural", col = "gray70", cex = 2, font = 2)
